//
//  Person.m
//  02-ClassAddObject
//
//  Created by dllo on 16/7/5.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "Person.h"

@implementation Person
//实现：方法加{}
- (void)sleep:(NSInteger)time
{
    //NSLog属于C语言的函数
    NSLog(@"这个人睡了%ld年",time);
}

- (void)setName:(NSString *)name
{
    _name = name;
}

//无论调用那个初始化方法，都会执行的初始化方法，成为指派初始化
- (instancetype)initWithName:(NSString *)name age:(NSInteger)age
{
    self = [super init];
    if (self) {
        _name = name;
        _age = age;
    }
    return self;
}



@end
